#include <rtl/print.h>

#define SIG 0x43474244

typedef struct _RC_HEADER {
    UINT32 Sig;
    UINT32 OffPl;
    UINT32 OffPpl;
    UINT32 SzPl;
    UINT32 OffLk;
    UINT32 OffPlk;
    UINT32 SzLk;
    UINT32 U[9];
} RC_HEADER, *PRC_HEADER;

#define SRAM_ADDR 0x11D000
#define DRAM_ADDR 0x44400000

VOID Try(UINT32 Addr) {
    PRC_HEADER Header = (PRC_HEADER)Addr;
    
    if (Header->Sig == SIG) {
        RtlPrintf("rc@%x signature valid\n", Addr);
        RtlPrintf("rc@%x off_pl  = %u\n", Addr, Header->OffPl);
        RtlPrintf("rc@%x off_ppl = %u\n", Addr, Header->OffPpl);
        RtlPrintf("rc@%x sz_pl   = %u\n", Addr, Header->SzPl);
        RtlPrintf("rc@%x off_lk  = %u\n", Addr, Header->OffLk);
        RtlPrintf("rc@%x off_plk = %u\n", Addr, Header->OffPlk);
        RtlPrintf("rc@%x sz_lk   = %u\n", Addr, Header->SzLk);
    } else {
        RtlPrintf("rc@%x signature invalid\n", Addr);
    }
}

VOID AgpRetrieveRamConsole() {
    Try(SRAM_ADDR);
    Try(DRAM_ADDR);
}